Blocks: Use do_blocks to render core blocks content #8019
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #6662
This pull request seeks to resolve an issue where shared blocks which contain InnerBlocks content (e.g. Columns) would not render its content on the front-end.
Implementation notes:
The root cause is that we were parsing the content as blocks and relying on the parsed block's
innerHTML
to be the render output. For nested blocks, theinnerHTML
does not include its child block contents. It is also not possible to reconstruct this block on the server.Instead, the approach here simply treats the shared block's content as if it were a post containing blocks, leveraging the
do_blocks
function to pass its content string. This should support not only inner blocks, but also dynamic block replacement (e.g. shared blocks in shared blocks).This may also have a performance benefit, avoiding a costly full content parse in lieu of
do_blocks
simpler implementation.Testing instructions:
Repeat steps to reproduce from #6662, noting there are no issues in the display of the shared Columns block on the front-end of the site.